/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package util;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

/**
 *
 * @author rdelacruz
 */
public class StringEscapeUtil {
    
          
    public static String codificarURL(String texto) throws UnsupportedEncodingException {
        //Ejemplo1: Usando java.net.URLEncoder
        return URLEncoder.encode(texto, "UTF-8");//http://stackoverflow.com/questions/10786042/java-url-encoding
        
        //Ejemplo2: Usando org.apache.commons.httpclient.util.URIUtil.encodeQuery in Apache commons-httpclient
        // http://stackoverflow.com/questions/573184/java-convert-string-to-valid-uri-object
        //[URIUtil][2].encodeQuery("http://www.google.com?q=a b")
        //http://www.google.com?**q=a%20b**
    }
        
}
